<?php
class RelatestudentController extends MyClass_Action {
	protected $controller;
	protected $action;
	protected $_user;
	
	public function init() {
		$this->commonAction();	
	}
       
	public function indexAction(){
		try {
		 
			echo $sql = "select DISTINCT(p1.pid),p1.realname,p1.mobile,s.cnname
from parents p1,parents p2, etonkids.student s where p1.pid=s.uid and p1.pid<>p2.pid and p1.mobile=p2.mobile and p1.mobile<>'' and p1.inactive=0 order by p1.mobile";exit();       		
            $result = $this->_dbAdapter->fetchAll($sql);    
		    $this->view->result = $result; 
		    $this->_smarty->display ( $this->controller . '/' . $this->action . '.tpl' );	
		} catch ( Exception $e ) {
				$this->feedback ( $e->getMessage (), 'note', 'javascript:window.history.back();', 'warning' );
		}
	}
	public function __call($method, $args) {
		if ('Action' == substr ( $method, - 6 )) {
			$url = '/' . $this->controller . '/index';
			return $this->_redirect ( $url );
		}
		throw new Exception ( 'Invalid method' );
	}
}
?>
